﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Admincp/Admin.Master" AutoEventWireup="true" CodeBehind="Doanhthutheokhachhang.aspx.cs" Inherits="TPCN.Admincp.Doanhthutheokhachhang" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="nameholder" runat="server">
Thống kê doanh thu
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="maincontent" runat="server">
    <!-- Script manager -->
    <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
        <Scripts>
            <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.Core.js" />
        </Scripts>
    </telerik:RadScriptManager>
    <div class="date message info">
        <div class="filter-row">
            <span>Ngày bắt đầu :
                <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="*"
                    ControlToValidate="dateStart"></asp:RequiredFieldValidator>
            </span><span>
                <telerik:RadDatePicker ID="dateStart" runat="server" Width="100px" Culture="vi-VN">
                    <Calendar ID="Calendar1" UseColumnHeadersAsSelectors="False" UseRowHeadersAsSelectors="False"
                        ViewSelectorText="x" runat="server">
                    </Calendar>
                    <DateInput ID="DateInput1" runat="server" DateFormat="dd/MM/yyyy" DisplayDateFormat="dd/MM/yyyy">
                    </DateInput>
                    <DatePopupButton HoverImageUrl="" ImageUrl="" />
                </telerik:RadDatePicker>
            </span><span>Ngày kết thúc :
                <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ErrorMessage="*"
                    ControlToValidate="dateEnd"></asp:RequiredFieldValidator></span><span>
                        <telerik:RadDatePicker ID="dateEnd" runat="server" Width="100px" Culture="vi-VN">
                            <Calendar ID="Calendar2" UseColumnHeadersAsSelectors="False" UseRowHeadersAsSelectors="False"
                                ViewSelectorText="x" runat="server">
                            </Calendar>
                            <DateInput ID="DateInput2" runat="server" DateFormat="dd/MM/yyyy" DisplayDateFormat="dd/MM/yyyy">
                            </DateInput>
                            <DatePopupButton HoverImageUrl="" ImageUrl="" />
                        </telerik:RadDatePicker>
                    </span><span>Khách hàng :
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ErrorMessage="*"
                            ControlToValidate="cboCustomer"></asp:RequiredFieldValidator>
                    </span><span>
                        <asp:DropDownList ID="cboCustomer" runat="server" Width="192px" />
                    </span>
        </div>
        <div class="right">
            <asp:Button ID="btnSubmit" runat="server" Text="Tính doanh thu" CssClass="button button-blue"
                OnClick="btnSubmit_Click" /></div>
    </div>
    <div class="money">
        Tổng doanh thu : <span>
            <asp:Literal ID="lblMoney" runat="server" Text="0" /></span>
    </div>
    <div>
        <asp:Panel ID="GridViewPanel" runat="server">
            <asp:GridView ID="DoanhthuGridView" runat="server" AutoGenerateColumns="False" Width="100%"
                DataKeyNames="KhachID" Height="16px" AllowPaging="True" GridLines="None" CssClass="mGrid"
                AlternatingRowStyle-CssClass="alt" PagerStyle-CssClass="pgr" PageSize="15" 
                onpageindexchanging="DoanhthuGridView_PageIndexChanging">
                <HeaderStyle HorizontalAlign="Center" />
                <AlternatingRowStyle CssClass="alt" />
                <Columns>
                    <asp:BoundField DataField="KhachID" HeaderText="Mã khách hàng">
                        <ItemStyle HorizontalAlign="Center" />
                    </asp:BoundField>
                    <asp:TemplateField HeaderText="Tên khách hàng">
                        <ItemTemplate>
                            <asp:Literal ID="productName" runat="server" Text='<%# GetCustomerNameById(Eval("KhachID")) %>' />
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Tổng tiền đã mua">
                        <ItemTemplate>
                            <asp:Literal ID="tongtien" runat="server" 
                                Text='<%# FormatMoney(Eval("Tongtien")) %>' />
                        </ItemTemplate>
                    </asp:TemplateField>
                </Columns>
                <PagerSettings FirstPageText="Đầu" LastPageText="Cuối" Mode="NumericFirstLast" NextPageText="Tiếp"
                    PreviousPageText="Trước" PageButtonCount="5" />
                <PagerStyle CssClass="pgr" />
            </asp:GridView>
        </asp:Panel>
    </div>
    <div class="message error">
        Doanh thu chưa bao gồm chiết khấu theo hóa đơn!
    </div>
</asp:Content>
